﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLBH.Model.Controller;
using QLBH.DataModel;
using QLBH.ModelInterface;

namespace QLBH.Category.Presenter
{
    public class QLKhoPresenter
    {
        public QLKhoPresenter()
        {

        }
        /// <summary>
        /// Lay ve danh sach cac kho trong database
        /// </summary>
        /// <returns></returns>
        public List<IQLKhoModel> GetDSKhoHang()
        {
            List<IQLKhoModel> khohangs = new List<IQLKhoModel>();
            var item = KhoController.GetInstance().GetAll();
            if (item != null)
            {
                foreach (KHO k in item)
                {
                    IQLKhoModel model = ModelFactory.ModelFactory.GetQLKhoModelInstance();
                    model.KhoID = k.KHOID;
                    model.MaKho = k.KHOCODE;
                    model.TenKho = k.TENKHO;
                    model.DiaChi = k.DIACHI;
                    model.GhiChu = k.GHICHU;
                    model.MacDinh = (bool)k.MACDINH;
                    khohangs.Add(model);
                }
            }
            return khohangs;
        }
    }
}
